# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    def getKthFromEnd(self, head: ListNode, k: int) -> ListNode:
        f=s=head
        for i in range(k):
            f=f.next
        while f:
            f=f.next
            s=s.next
        return s